package com.xiaoluo.common.queue;

import com.xiaoluo.cd.entity.base.Jobs;
import com.xiaoluo.common.utils.ApplicationContextUtils;
import com.xiaoluo.common.utils.Tools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * Project : XL-CD
 * Package : com.xiaoluo.common.queue
 * Created by Willian.
 * Date  : 2016/1/6 20:51.
 */
public class JobWorker implements Runnable{
    private final static Logger logger = LoggerFactory.getLogger(JobWorker.class);

    private Jobs obj;

    public JobWorker(Jobs obj){
        super();
        this.obj = obj;
    }

    @Override
    public void run() {
        logger.info("Run Job:{}",obj.getJobName());
        ApplicationContextUtils.jobService.runJob(obj);
        logger.info("Run Job:{} end.",obj.getJobName());
    }
}
